#define _CRT_SECURE_NO_WARNINGS 1
#include <stdio.h>

int main() {
    int n;
    scanf("%d", &n);
    int sum = 2;
    int flag = 2;
    for (int i = 0; i < n - 1; i++)
    {
        flag += 3;
        sum += flag;
    }
    printf("%d", sum);
    return 0;
}